package com.web.main.entity.form;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * @create 2020-11-25 17:26
 */
@Data
@ApiModel(value = "接收前端电桩对象")
public class PileForm implements Serializable {

    private static final long serialVersionUID = 3501759895558956220L;

    public interface Add{}
    public interface Modify{}

    @ApiModelProperty(value = "电桩主键id")
    @NotEmpty(message = "电桩id不能为空", groups = Modify.class)
    @Size(min = 19, max = 19, message = "主键长度为19为", groups = Modify.class)
    private String pileId;

    @ApiModelProperty(value = "供应商主键id")
    @NotEmpty(message = "供应商主键不能为空", groups = Add.class)
    @Size(min = 19, max = 19, message = "主键长度为19为", groups = {Add.class, Modify.class})
    private String supplierId;

    @ApiModelProperty(value = "充电站id")
    @NotEmpty(message = "充电站id不能为空", groups = Add.class)
    @Size(min = 19, max = 19, message = "充电站id长度为19位", groups = {Add.class, Modify.class})
    private String siteId;

    @ApiModelProperty(value = "电桩类型（0：国际、1：特斯拉，默认0）")
    @NotNull(message = "电桩类型不能为空", groups = Add.class)
//    @Pattern(regexp = "^[0-1]$", message = "请选择电桩类型：0:国际/1:特斯拉", groups = {Add.class, Modify.class})
    @Min(value = 0, message = "请选择电桩类型：0:国际/1:特斯拉", groups = {Add.class, Modify.class})
    @Max(value = 1, message = "请选择电桩类型：0:国际/1:特斯拉", groups = {Add.class, Modify.class})
    private Integer pileType;

    @ApiModelProperty(value = "电桩型号（0：快充、1：慢充，默认0）")
    @NotNull(message = "请选择电桩型号", groups = Add.class)
//    @Pattern(regexp = "^[0-1]$", message = "请选择0:快充/1:慢充", groups = {Add.class, Modify.class})
    @Min(value = 0, message = "请选择0:快充/1:慢充", groups = {Add.class, Modify.class})
    @Max(value = 1, message = "请选择0:快充/1:慢充", groups = {Add.class, Modify.class})
    private Integer pileModel;

    @ApiModelProperty(value = "状态（0：空闲、1：使用中、2：维修中,默认0）")
//    @Pattern(regexp = "^[0-3]$", message = "状态只能为：（0：空闲、1：使用中、2：维修中,默认0）")
    @Min(value = 0, message = "状态（0：空闲、1：使用中、2：维修中,默认0）", groups = {Add.class, Modify.class})
    @Max(value = 2, message = "状态（0：空闲、1：使用中、2：维修中,默认0）", groups = {Add.class, Modify.class})
    private Integer pileState;

}
